import React from 'react'
import { connect } from 'react-redux'
import { projectConfig as duck } from 'ducks'
import Nomal from './normalType'
import KeyPoint from './keyPoint'

const SwitchType = ({ type }) => {
  let Comp
  switch (type) {
    case 'rectangle':
    case 'polygon':
      Comp = Nomal
      break
    case 'keyPoint':
      Comp = KeyPoint
      break
    default:
      Comp = Nomal
      break
  }
  return <Comp />
}

const mapStateToProps = state => ({
  type: duck.selectors.newClassType(state),
})

export default connect(mapStateToProps)(SwitchType)
